package com.neusoft.neuiotms.dcam.fixed.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 产品
 *
 * @author sunchf
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_fixed_product")
@org.hibernate.annotations.Table(appliesTo = "neuiot_fixed_product", comment = "固定资产产品表")
public class Product extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    /** 产品名 */
    @NotBlank(message = "产品名不能为空")
    @Length(max = 50, message = "产品名不能超过{max}位")
    @Column(length = 50, nullable = false)
    @Comment("varchar(50) NOT NULL COMMENT '名称'")
    private String name;

    @NotNull(message = "固定资产类型不能为空")
    @ManyToOne
    @Comment("bigint(20) NOT NULL COMMENT '资产类型 id'")
    private AssetType assetType;

    /** 规格型号 */
    @NotBlank(message = "规格型号不能为空")
    @Length(max = 100, message = "规格型号不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NOT NULL COMMENT '规格型号'")
    private String specification;

    /** 计量单位 */
    @Comment("varchar(10) NULL DEFAULT NULL COMMENT '计量单位'")
    private String measureUnit;

    /** 原值 */
    @Column(length = 10, nullable = true)
    @Comment("double(10,2) COMMENT '金额'")
    private Double money;

}
